package org.alex.samples.dao;

import java.util.List;

import org.alex.samples.model.ExamTest;
import org.alex.samples.model.TestType;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
@Transactional
public class ExamTestTypeDAOImpl extends BaseHibernateDAO<TestType> implements IExamTestTypeDAO {

	@Override
	public List<TestType> findAllExamTestTypes() {
		String hql="from ExamTestType";
		List<TestType> examTypeList = this.find(hql);
		return examTypeList;
	}

	@Override
	public TestType getExamTestTypeById(Integer id) {
		TestType exsitsExamTestType = this.get(id);
		return exsitsExamTestType;
	}

	@Override
	public void createExamTestType(TestType examTestType) throws Exception {
		this.save(examTestType);
		
	}

	@Override
	public void editExamTestType(TestType examTestType) throws Exception {
		this.update(examTestType);
		
	}

	@Override
	public void deleteExamTestType(Integer id) throws Exception {
		TestType exsitsExamTestType = this.get(id);
		if(exsitsExamTestType!=null){
			this.delete(exsitsExamTestType);
		}
		
	}



}
